var remoteModuleDateSource = function (options, callback) {
    var self = this;
    var $data = null;

    if (!("name" in options) && !("type" in options)) {
        callback({data: queryModuleData('0')});//
        return;
    } else if ("type" in options && options.type == "folder") {
        if ("additionalParameters" in options && "children" in options.additionalParameters)
            $data = queryModuleData(options.additionalParameters.id);//点击父节点，加载子节点
        else {
            $data = {}
        }//no data
    }
    if ($data != null) {//this setTimeout is only for mimicking some random delay
        callback({data: $data});
    }
};

function queryModuleData(parentCode) {
    var treeData = null;
    $.ajax({
        url: ctx + '/tbSysModule/queryTreeData?number='+ Math.random(),
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            parentCode: parentCode
        },
        success: function (data) {
            if (data.success) {
                treeData = data.result;
            }
        }
    });
    return treeData;
}
